<template>
	<view class="root-view">
		<view class="device-layout-block">
			<view class="device-layout-mod">
				<view class="device-layout-mbody">
					<view class="textinfo-box">
						<view class="textinfo-title">自定义设备名称</view>
					</view>
					<view class="uform-box u-p-b-64">
						<u-form class="u-border-top" :model="form" ref="uForm">
							<u-form-item>
								<u-input v-model="name" type="text" placeholder="请输入设备名称" />
							</u-form-item>
						</u-form>
					</view>
					
				</view>
				<view class="device-layout-mfoot ">
					<view class="device-layout-btns">
						<view class="btn-cell">
							<button class="coco-btn theme round lg shadow" @click="editDevice();">修改</button>
						</view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import evanStep from '@/components/evan-steps/evan-step.vue';
	export default {
		components:{
			evanStep
		},
		data() {
			return {
				numList: [{
					name: '滤芯'
				}, {
					name: 'WIFI'
				}, {
					name: '设备'
				} ],
				form: {
					wifiName: '',
					wifiPassword: '',
				},
				gbWifi:null,
				bssid:'',
				disabled:false,
				device_id:0,
				name:''
			};
		},
		onLoad(opt) {
			this.device_id = opt.id ? opt.id : 0;
			this.name = opt.name ? opt.name : '';
		},
		methods:{
			jump(path) {
				this.$tools.routerTo(path);
			},
			editDevice(){
				this.$post("/api/device/edit_device",{
					id:this.device_id,
					name:this.name
				}).then(res => {
					if(res.code == 1){
						this.$u.toast("修改成功");
						uni.navigateBack();
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	@import "./css/device.scss";
	 
</style>
